#author Sylvain Bertrand <digital.ragnarok@gmail.com>
#Protected by GNU Affero GPL v3 with some exceptions.
.PHONY:all check_env clean

CC=gcc

BINS=\
dma_l2l \
dma_u32_fill \
modeset \
pf \
dpm \
edid \
tri

all:check_env $(BINS)

check_env:
	@if test -z "$${ALGA_INCLUDE}"; then \
	    echo "missing ALGA_INCLUDE environment variable"; exit 1; \
	 fi

dma_l2l:dma_l2l.c
	$(CC) -Wall -I "$(ALGA_INCLUDE)" -o $@ $^

dma_u32_fill:dma_u32_fill.c
	$(CC) -Wall -I "$(ALGA_INCLUDE)" -o $@ $^

modeset:modeset.c
	$(CC) -Wall -std=gnu99 -I "$(ALGA_INCLUDE)" -lm -o $@ $^

pf:pf.c
	$(CC) -Wall -I "$(ALGA_INCLUDE)" -o $@ $^

dpm:dpm.c
	$(CC) -Wall -I "$(ALGA_INCLUDE)" -o $@ $^

edid:edid.c
	$(CC) -Wall -I "$(ALGA_INCLUDE)" -o $@ $^

tri:tri.c
	$(CC) -Wall -I "$(ALGA_INCLUDE)" -o $@ $^

clean:
	-rm -f $(BINS)
